﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SportsStore.Repository.Contexts;
using SportsStore.Model;

namespace SportsStore.Repository.Initiaizers
{
  public class ProductTestInitializer : CreateDatabaseIfNotExists<SportsStoreDbContext>
  {
        protected override void Seed(SportsStoreDbContext context)
    {
      var Watersports = new Category() { Id = 1, Name = "Watersports" };
      var Soccer = new Category() { Id = 2, Name = "Soccer" };
      var Chess = new Category() { Id = 3, Name = "Chess" };

      context.Products.AddOrUpdate(p => p.Name,
                                    new Product { Name = "Kayak", Description = "A boat for one person", Category = Watersports, Price = 275M },
                                    new Product { Name = "Lifejacker", Description = "Protective and fashionable", Category = Watersports, Price = 48.95M },
                                    new Product { Name = "Soccer Ball", Description = "FIFA-approved size and weight", Category = Soccer, Price = 19.50M },
                                    new Product { Name = "Corner flags", Description = "Give your playing field that professional touch", Category = Soccer, Price = 34.95M },
                                    new Product { Name = "Staduim", Description = "Flat-packed 35,000-seat staduim", Category = Soccer, Price = 79500.00M },
                                    new Product { Name = "Thinking cap", Description = "Improve your brain efficiency by 75%", Category = Chess, Price = 16.00M },
                                    new Product { Name = "Unsteady Chair", Description = "Secretly give your opponent a disadvantage", Category = Chess, Price = 29.95M },
                                    new Product { Name = "Human Chess", Description = "A fun game for the whole family", Category = Chess, Price = 75.00M },
                                    new Product { Name = "Bling-bling King", Description = "Gold-plated, diamond-studded King", Category = Chess, Price = 1200.00M }
        );

      context.SaveChanges();
       
    }
  }
}